<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>用户综合管理 - 学生宿舍管理系统</title>
		<link rel="shortcut icon" href="img/head.png" type="image/x-icon">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">

		<link rel="stylesheet" href="volunteer/admin/css/layui/css/layui.css" media="all">
		
        <link rel="stylesheet" href="volunteer/admin/css/biaoge.css">
        <link rel="stylesheet" href="volunteer/admin/css/quyu.css">
        <script type="text/javascript" src="volunteer/admin/js/xadmin.js"></script>
        <script type="text/javascript" src="volunteer/admin/js/admin.js"></script>
        <script src="volunteer/admin/css/layui/layui.js" charset="utf-8"></script>
        <style>
            .box1 {
                text-align: center;
                width: 100%;
                margin-top: 10px;
            }
            .table1 img{
                width: 200px;
            }
            .button1{margin-left:10000000000000px;}
            .eject{display: none}
            
            .list li input,textarea{
		
		         border: 1px solid #DADADA;
		
		         color: #888;
		
		         height: 30px;
		
		         margin-bottom: 16px;
		
		         
		
		         margin-top: 2px;
		
		         outline: 0 none;
		
		         padding: 3px 3px 3px 5px;
		
		         width: 70%;
		
		         font-size: 17px;
		
		         line-height: 25px;
		
		         box-shadow: inset 0px 1px 4px #ECECEC;
		
		         -moz-box-shadow: inset 0px 1px 4px #ECECEC;
		
		         -webkit-box-shadow: inset 0px 1px 4px #ECECEC;
		
		      }
		      .list li{
		      margin-top:  30px;
		      margin-left: 15%;
		      }
		      .box10{margin-left:48%; margin-top:0%;}
		      h3 {
			    text-align: center;
			    font-size: 25px;
			    color: aliceblue;
			    font-family: 华文楷体;
			}
        </style>
	</head>
	<body>
		<c:set var="List" value="${requestScope.List.subList(Page.beginIndex,Page.endIndex)}"/>
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header">
				<div class="layui-logo" style="width: 300px;"><h3 >“东软”志愿者管理系统</h3></div>
				<!-- 头部区域（可配合layui 已有的水平导航） -->
				<div class="left_open">
					<a><i class="layui-icon">&#xe668;</i></a>
				</div>
				<ul class="layui-nav layui-layout-right">
					<li class="layui-nav-item">
						<a href="javascript:;">
							<img src="volunteer/img/13.jpg" class="layui-nav-img">
							院级管理员
						</a>
						<dl class="layui-nav-child">
							<dd><a href="">切换账号</a></dd>
							<dd><a href="volunteer/Login&Register.jsp">退出</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item"><a href="">前台首页</a></li>
				</ul>
			</div>

			<div class="layui-side layui-bg-black">
				<div class="layui-side-scroll">
                    <div class="box1">
                        <img src="volunteer/img/13.jpg" alt="">
                    </div>
					<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
					<ul class="layui-nav layui-nav-tree" lay-filter="test">
                        
						<li class="layui-nav-item"><a href="volunteer/admin/home.jsp"><i class="layui-icon">&#xe68e;</i>&nbsp;&nbsp;主页</a></li>
						<li class="layui-nav-item ">
							<a href="javascript:;"><i class="layui-icon">&#xe66f;</i>&nbsp;&nbsp;志愿者管理</a>
							<dl class="layui-nav-child">
								<dd ><a href="Volunteer">志愿者列表</a></dd>
								<dd><a href="volunteer/admin/detail.jsp">志愿者详情</a></dd>
                                <dd><a href="Examine">志愿者审批</a></dd>
                                <dd><a href="Blist">黑名单</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item layui-nav-itemed">
							<a href="javascript:;"><i class="layui-icon">&#xe653;</i>&nbsp;&nbsp;活动管理</a>
							<dl class="layui-nav-child">
								<dd class="layui-this"><a href="News">新闻管理</a></dd>
								<dd><a href="Notice">志愿活动</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item">
							<a href="javascript:;"><i class="layui-icon">&#xe67a;</i>&nbsp;&nbsp;物资管理</a>
							<dl class="layui-nav-child">
								<dd><a href="3-1.html">物资管理</a></dd>
								<dd><a href="3-2.html">物资管理</a></dd>
								<dd><a href="3-3.html">物资管理</a></dd>
								<dd><a href="3-4.html">物资管理</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item"><a href="7-1.html"><i class="layui-icon">&#xe60b;</i>&nbsp;&nbsp;个人中心</a></li>
					</ul>
				</div>
			</div>

			<div class="layui-body" style="bottom: 0px;">
                <ol class="breadcrumb">
                    <li><a href="#">主页</a></li>
                    <li class="active">新闻管理</li>
                </ol>
				<!-- 内容主体区域 -->
                <div style="margin: 20px;  background-color: #F6F6F6;">
                    <div style="padding: 10px;padding-top: 10px; padding-bottom: 5px;">

                        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="margin-top: 0px;">
                            <!-- <ul class="layui-tab-title">
                                <li class="layui-this">新增用户</li>
                                <li>删除用户</li>
                                <li>修改用户信息</li>
                            </ul> -->
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <input class="input" placeholder="请输入公告标题" type="search" name="googlesearch">
                                    <!-- <button type="button" class="btn btn-primary btn-sm">查询</button> -->
                                    <button class="layui-btn box7"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                    <button type="button" class="layui-btn layui-btn-normal button1" style="margin-left:2.5%" onclick="pass2(this)"><i class="layui-icon">&#xe61f;</i>添加</button>
                                        <div class="eject" id="biao">
											<form class="layui-form" action="/Volunteer/AddNews" method="post">
											      <div class="card">
														<ul class="list">
														    
															<li><label >标题：&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="text" name="title"></li>
															
															<li><label>轮播图：</label><input type="file"  name="pricture"></li>
															<label style="float:left; margin-left: 15%; margin-top:  30px;">内容：&nbsp;&nbsp;&nbsp;&nbsp;</label>
															<li><textarea name="content" rows="5" cols="60" style="height:100px; weight:65%;"></textarea></li>
															
														</ul>
														<div class="box10">
															<button id="pay" class="layui-btn layui-btn-normal pay" ">添加</button>
														</div>
													</div>
											</form>
									    </div>
                                    <form class="layui-form" action="">
                                        
                                        <table align="center"  class="table  table-striped  table-hover table-condensed table-responsive">
                                            <thead>
                                                <tr style="background-color: #5687dc; color: #fff; ">
                                                    <th style="vertical-align: middle; width: 8%;">编号</th>
                                                    <th style="vertical-align: middle; width: 15%;">新闻标题</th>
                                                    <th style="vertical-align: middle; width: 23%;" >轮播图</th>
                                                    <th style="vertical-align: middle; width: 10%;">是否推荐</th>
                                                    <th style="vertical-align: middle;">新闻内容</th>
                                                    <th style="vertical-align: middle;" width="17%">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody class="table1">
                                                <c:forEach items="${List}" var="a" varStatus="st">
	                                            <tr >
                                                    <td><div style="margin-top: 30px;">${st.index+1+Page.beginIndex}</div></td>
                                                    <td><div style="margin-top: 30px;">${a.title}</div></td>
                                                    <input id="title${st.index}" type="hidden" name="title" value="${a.title}">
                                                    <td><img src="volunteer/img/${a.pricture}" width="100px" height="100px"></td>
                                                    <td ><div style="margin-top: 22px;"><input  type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked></div></td>
                                                    <td><div style="margin-top: 15px;">${a.content}</div></td>
                                                    <input id="id${st.index}" type="hidden" name="id" value="${a.id}">
                                                    <td>
                                                        <div style="margin-top: 28px;">
                                                            <button type="button" class="layui-btn layui-btn-normal"
                                                            onclick="pass(${st.index})">内容编辑</button>
                                                            <a onclick="return check(${st.index})"><button type="button" class="layui-btn layui-btn-danger">撤销</button></a>
                                                        </div>
                                                    </td>
                                                    <div class="eject" id="biaoge${st.index}">
														<form action="/Volunteer/UpdateNews" method="post">
														      <div class="card">
																	<ul class="list">
																	    <input type="hidden" name="id" value="${a.id}">
																		<li><label >标题：&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="text" name="title" value="${a.title}"></li>
																		<li><label>轮播图：</label><input type="text" name="pricture" value="${a.pricture}"></li>
																		<label style="float:left; margin-left: 15%; margin-top:  30px;">内容：&nbsp;&nbsp;&nbsp;&nbsp;</label>
																		<li><textarea name="content" rows="5" cols="60" style="height:100px; weight:65%;">${a.content}</textarea></li>
																		
																	</ul>
																	<div class="box10">
																		<button id="pay1" class="layui-btn layui-btn-normal pay">修改</button>
																	</div>
																</div>
														</form>
													</div>
                                                </tr>
                                                </c:forEach>
<!--                                                 <tr> -->
<!--                                                     <td><div style="margin-top: 30px;">2</div></td> -->
<!--                                                     <td><div style="margin-top: 30px;">防控志愿服务工作指引</div></td> -->
<%--                                                     <td><img src="${a.pricture}" width="100px" height="100px"></td> --%>
<!--                                                     <td ><div style="margin-top: 22px;"><input  type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked></div></td> -->
<%--                                                     <td><div style="margin-top: 10px;">${a.content}</div></td> --%>
                                                    
<!--                                                     <td> -->
<!--                                                         <div style="margin-top: 28px;"> -->
<!--                                                             <button type="button" class="layui-btn layui-btn-normal" -->
<!--                                                             onclick="xadmin.open('添加用户','./gai.html',300,150)">内容编辑</button> -->
<!--                                                             <button type="button" class="layui-btn layui-btn-danger">撤销</button> -->
<!--                                                         </div> -->
<!--                                                     </td> -->
                                                    
<!--                                                 </tr> -->
<!--                                                 <tr> -->
<!--                                                     <td><div style="margin-top: 30px;">3</div></td> -->
<!--                                                     <td><div style="margin-top: 30px;">疫情防控工作的通知</div></td> -->
<!--                                                     <td><img src="img/news3.jpg" width="100px" height="100px"></td> -->
<!--                                                     <td ><div style="margin-top: 22px;"><input  type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked></div></td> -->
<!--                                                     <td><div style="margin-top: 10px;">为快速有效阻断疫情传播，实现科学精准防控，切实保障辖区内群众生命安全和身体健康，按照《新型冠状病毒肺炎疫情防控方案（第九版）》有关规定...</div></td> -->
                                                    
<!--                                                     <td> -->
<!--                                                         <div style="margin-top: 28px;"> -->
<!--                                                             <button type="button" class="layui-btn layui-btn-normal" -->
<!--                                                             onclick="xadmin.open('添加用户','./gai.html',300,150)">内容编辑</button> -->
<!--                                                             <button type="button" class="layui-btn layui-btn-danger">撤销</button> -->
<!--                                                         </div> -->
<!--                                                     </td> -->
                                                    
<!--                                                 </tr> -->
<!--                                                 <tr> -->
<!--                                                     <td><div style="margin-top: 30px;">4</div></td> -->
<!--                                                     <td><div style="margin-top: 30px;">肺炎疫情防控工作指引</div></td> -->
<!--                                                     <td><img src="img/news4.jpg" width="100px" height="100px"></td> -->
<!--                                                     <td ><div style="margin-top: 22px;"><input  type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked></div></td> -->
<!--                                                     <td><div style="margin-top: 10px;">当前疫情防控总体形势及专家组研判，为更好统筹疫情防控阻击战和经济社会发展，尽最大可能让广大群众回归正常生产生活，经区疫情防控指挥部研究，对部分防控措施作出相应调整...</div></td> -->
                                                    
<!--                                                     <td> -->
<!--                                                         <div style="margin-top: 28px;"> -->
<!--                                                             <button type="button" class="layui-btn layui-btn-normal" -->
<!--                                                             onclick="xadmin.open('添加用户','./gai.html',300,150)">内容编辑</button> -->
<!--                                                             <button type="button" class="layui-btn layui-btn-danger">撤销</button> -->
<!--                                                         </div> -->
<!--                                                     </td> -->
                                                    
<!--                                                 </tr> -->
                                            </tbody>
                                        </table>
                                    </form>
                                    <div class="footer">
			                             <ul class="pagination">
							                <li><a href="<c:url value="?page=1"/>">首页</a></li>
							                <li><a href="<c:url value="?page=${Page.page-1>1?Page.page-1:1}"/>">&laquo;</a></li>
							 
							                <c:forEach begin="1" end="${Page.toall}" varStatus="loop">
							                    <c:set var="active" value="${loop.index==Page.page?'active':''}"/>
							                    <li class="${active}"><a
							                            href="<c:url value="?page=${loop.index}"/>">${loop.index}</a>
							                    </li>
							                </c:forEach>
							                <li>
							                    <a href="<c:url value="?page=${Page.page+1<Page.toall?Page.page+1:Page.toall}"/>">&raquo;</a>
							                </li>
							                <li><a href="<c:url value="?page=${Page.toall}"/>">尾页</a></li>
							            </ul>
                                    </div>
                                </div>
    
                            </div>
                            
                        </div>
    
                    </div>
                </div>

			</div>


		</div>
<script src="volunteer/admin/css/layui/layui.js" charset="utf-8"></script>   

<script>
function pass(st){
	// 挂载layui，添加jquery和form 一会我们会用到
	  layui.use(['layer', 'jquery', 'form'], function () {
	    // 这个时候将挂载到layui中的layer放置到一个变量上面，有助于我们调用
	    var layer = layui.layer
	    var $ = layui.jquery
	    var form = layui.form
	    form.render(null, 'form')
	    // 首先第一种调用方法就是(采用的是jquery的点击事件)
	    layer.open({
	    	shade:0.0,
	        type: 1,
	        title: '修改公告',
	        area: ['60%', '55%'],//弹框大小  屏幕宽度的80%，高度的80%；
	        content: $('#biaoge'+st), //可以使用$('#id,.class')这种方式来指定模板，可以将其理解为指定一个组件，当然也是可以自己去写的,像'<div>我是一个内容</div>'
	        // 打开弹窗的回调函数，用于回显页面数据
	        success: function () {
	          console.log('我打开了弹窗')
	        },
	      })
	    // 表单提交事件
	    form.on('submit(submit)', function (data) {
	      console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
	      console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
	      console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
	    })
	  })
};

function pass2(e){
	// 挂载layui，添加jquery和form 一会我们会用到
	 layui.use(['layer', 'jquery', 'form'], function () {
	   // 这个时候将挂载到layui中的layer放置到一个变量上面，有助于我们调用
	   var layer = layui.layer
	   var $ = layui.jquery
	   var form = layui.form
	   form.render(null, 'form')
	   // 首先第一种调用方法就是(采用的是jquery的点击事件)
	   layer.open({
	   	shade:0.0,
	       type: 1,
	       title: '添加公告',
	       area: ['60%', '55%'],//弹框大小  屏幕宽度的80%，高度的80%；
	       content: $('#biao'), //可以使用$('#id,.class')这种方式来指定模板，可以将其理解为指定一个组件，当然也是可以自己去写的,像'<div>我是一个内容</div>'
	       // 打开弹窗的回调函数，用于回显页面数据
	       success: function () {
	         console.log('我打开了弹窗')
	       },
	     })
	   // 表单提交事件
	   form.on('submit(submit)', function (data) {
	     console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
	     console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
	     console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
	   })
	 })
};



</script>		
		
		
<script>
	//JavaScript 代码区域
	layui.use('element', function() {
		var element = layui.element;

	});

	function check(st){
		  var a = document.getElementById("id"+st).value; 
		  layer.confirm("确定要撤销吗？",{
			    btn2: function(index, layero){
			        //按钮【按钮二】的回调
			        return true;
			    }
			},
			function(index, layero){
			  //按钮【按钮一】的回调
			  window.location.replace('/Volunteer/DeleNews?id='+a)
			  return true;
			}
			);


	};
</script>
<script>
	var _hmt = _hmt || [];
	(function() {
		var hm = document.createElement("script");
		hm.src = "https://hm.baidu.com/hm.js?d214947968792b839fd669a4decaaffc";
		var s = document.getElementsByTagName("script")[0];
		s.parentNode.insertBefore(hm, s);
	})();

          layui.use(['laydate','form'], function(){
          });
</script>
            
	</body>
</html>




